package strategy.duck;

import strategy.flybehavior.FlyBehavior;
import strategy.quackbehavior.QuackBehavior;

/**
 * @author: zhouyang
 * @descrpition:
 * @time: 2019-04-28 17:45
 */
public abstract class AbstractDuck {
    protected FlyBehavior flyBehavior;
    protected QuackBehavior quackBehavior;
    public AbstractDuck(){}
    public void fly(){
        this.flyBehavior.fly();
    }
    public void quack(){
        this.quackBehavior.quack();
    }

    public abstract void display();
    public void setQuackBehavior(QuackBehavior quackBehavior){
        this.quackBehavior = quackBehavior;
    }

    public void setFlyBehavior(FlyBehavior flyBehavior){
        this.flyBehavior = flyBehavior;
    }

    public void swim(){
        System.out.println("~~im swim~~");
    }
}
